<script type="text/javascript">
var mail_content = null;
$(function () {
	var url = '${contextPath}script/sys/message.js?time=' + sys_get_time();
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
			<#if !((message.code)??)>
			addFilesUploadEvent_message();
			</#if>
			
			if(CKEDITOR.instances['mail_content']) 
				CKEDITOR.remove(CKEDITOR.instances['mail_content']);
			
			var uploadParm = {
				height:'150px',
				filebrowserBrowseUrl:'${contextPath}browse-file.html',
				filebrowserImageBrowseUrl:'${contextPath}browse-image.html',
				filebrowserUploadUrl:'${contextPath}m/message-upload.html?type=file',
				filebrowserImageUploadUrl:'${contextPath}m/message-upload.html?type=image',
				language:'zh-cn'
			}
			
			mail_content = CKEDITOR.replace('mail_content', uploadParm);
		}
	});
});
</script>

<div class="widget" style="float:left; width:720px;">
	<div class="widget-header">
		<h3 class="title"><i class="fontello-icon-th-list-1"></i> 编辑邮件</h3>
	</div>
	<div class="widget-content">
		<form id="editMessageForm">
			<input type="hidden" name="rec" value="${(message.code)!''}" />
			<table class="table boo-table table-content" style="width:100%; text-align:left;">
				<tr>
					<td class="table-left" style="width:100px;">标题</td>
					<td><input type="text" id="title" name="title" style="width:600px;" value="${(message.title)!''}" />
						<input type="hidden" id="code" name="code" value="${(message.code)!''}" /></td>
				</tr>
				<tr>
					<td class="table-left">内容</td>
					<td><textarea id="mail_content" style="width:600px;">${(message.content)!''}</textarea></td>
				</tr>
				<tr>
					<td class="table-left">附件 <#if !((message.code)??)> <a id="uploadFilesBtn" href="javascript:;">[选择]</a></#if></td>
					<td id="annexListTd">
					<#if (message.code)??>
					<#list list as ma>
					<div class="filter-table rep" style="margin-left:5px; margin-bottom:0px;">
						<a class="title" href="#">${ma.name}</a>
					</div>
					</#list>
					</#if>
					</td>
				</tr>
				<tbody id="replyObjectBody">
				<tr>
					<td class="table-left">接收人 <a href="javascript:;" onclick="javascript:selectUser_message();">[选择]</a></td>
					<td id="userListTd">
						<#if mr??>
						<div class="filter-table rep" style="margin-left:5px; margin-bottom:0px;">
							<input class="runs" type="hidden" name="run" value="${mr.ruc}" />
							<input class="em" type="hidden" name="email" />
							<button type="button" class="close" data-dismiss="alert" onclick="javascript: deleteSelectedItem_message($(this));">&times;</button>
							<a class="title" href="#">${mr.run}</a>
						</div>
						</#if>
					</td>
				</tr>
				</tbody>
				<tr>
					<td colspan="2" style="text-align:center;">
						<a href="javascript:;" class="btn btn-info" onclick="javascript:sendMessage_message();">
							<i class="fontello-icon-mail-4"></i>&nbsp;发&nbsp;&nbsp;送
						</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:;" class="btn btn-info" onclick="javascript:sys_load_handle('message');">
							<i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消
						</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>

<div id="tempAnnexListDiv" style="display:none;">
	<div class="filter-table rep" style="margin:0px 5px -10px 0px;">
		<input class="name" type="hidden" />
		<input class="size" type="hidden" />
		<input class="uuid" type="hidden" />
		<input class="ext" type="hidden" />
		<button type="button" class="close" data-dismiss="alert" onclick="javascript:deleteSelectedItem_message($(this));">&times;</button>
		<a class="title" href="#"></a>
	</div>
</div>
<div id="tempUserListDiv" style="display:none;">
	<div class="filter-table rep" style="margin-left:5px; margin-bottom:0px;">
		<input class="runs" type="hidden" name="run" />
		<input class="em" type="hidden" name="email" />
		<button type="button" class="close" data-dismiss="alert" onclick="javascript:deleteSelectedItem_message($(this));">&times;</button>
		<a class="title" href="#"></a>
	</div>
</div>

<input type="hidden" id="mail_an_index" value="0" />

